package com.example.administrator.waitan.find.news.food;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;

import com.example.administrator.waitan.R;
import com.example.administrator.waitan.base.BaseActivity;

/**
 * Created by Administrator on 2016/1/18.
 */
public class FoodContentActivity extends BaseActivity implements View.OnClickListener {
    private WebView foodWebView;
    private String url = "http://www.hongniujia.com/zhuti/remai/";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_newscontent);
        foodWebView = (WebView) findViewById(R.id.webView_item_foodContent);
        Intent receiveFood = getIntent();
        String foodId = receiveFood.getStringExtra("foodId");
        String foodType = receiveFood.getStringExtra("foodType");
        String foodUrl = url + foodId + "A" + foodType;
        foodWebView.getSettings().setJavaScriptEnabled(true);
        foodWebView.setWebViewClient(new WebViewClient() {
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                view.loadUrl(url);
                return true;
            }
        });
        foodWebView.loadUrl(foodUrl);
        ImageView imgReturn = (ImageView) findViewById(R.id.img_foodContent_return);
        imgReturn.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        finish();
    }
}
